#pragma once
#include <iostream>
#include <string>
#include <cstring>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/stat.h>
#include <cerrno>
#include <unistd.h>
#include <fcntl.h>
#include <cstdlib>

using namespace std;

// 生成一个唯一的路径和project_id
#define PATH "/home/Mr_Lin1/ExerciseCode/sharememory"
#define CHANNEL_NAME ".fifo"
int project_id = 123456;
#define SIZE 4096

int get_key() {
    key_t key = ftok(PATH, project_id);
    if (key == -1) {
        cerr << "errno:" << errno << "errnostring:" << strerror(errno) << endl;
        exit(-1);
    }
    return key;
}
